<?php
	header('content-type:text/html;charset=utf-8'); 
	//重要!兩種情況中都要判斷DID是否存在,DID不存在,還要判斷工單號和機台號是否為空
	//2018-3-16 11:08:32注釋:想起來好像前端就應該做判斷過濾掉這種情況
	//$GX=$_GET["nos"];
	
	//$except_number = $_POST["except_number"];//异常编码
	
	
	$pdo =new pdo("mysql:host=127.0.0.1;port=3306;dbname=tddb;","root","tdled2018");
	$pdo->query("set character set 'utf8'");//读库 
	$pdo->query("set names 'utf8'");//写库 
	
	
	$sql = 
	"SELECT 
		 count(*) as number
	FROM
		scanyichang
	WHERE
		`YiChangEndTime` is null"
	;
	$datas="";
	$res=$pdo->prepare($sql);//准备查询语句 
	$res->execute(); //执行一条查询语句
	
	//Fetch into associative array
	while ( $row = $res->fetch())  {
		//echo json_encode($row)."</br>";
		$datas=$row['number'];
	}
	
	//Print array in JSON format
	 print_r($datas); 
	
?>